package net.lzzy.practices.entities;

import com.fasterxml.jackson.annotation.JsonBackReference;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.Date;

/**
 * @author liaodcc.
 */
@Entity
@Getter
@Setter
public class Applicant extends BaseEntity{
    /**
     * 0 代表申请
     * 1 代表通过
     * 2 代表拒绝
     */
    @Transient
    public static final int TYPE_APPLYING = 0;
    @Transient
    public static final int TYPE_APPROVED = 1;
    @Transient
    public static final int TYPE_DECLINED = 2;
    private int status;
    @Temporal(TemporalType.TIMESTAMP)
    private Date applyTime;
    @ManyToOne
    private Course course;
    @ManyToOne
    private User student;
    public Applicant(){
        applyTime = new Date();
    }

    @JsonBackReference
    public Course getCourse() {
        return course;
    }

    @JsonBackReference
    public User getStudent() {
        return student;
    }
}
